package proxy;

public class Printer implements Printable {
    public String name;

    public Printer() {

    }

    public Printer(String name) {
        this.name = name;
    }

    public void heavyJob(String msg){
        System.out.print(msg);
        for(int i=0;i<5;i++){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.print(".");
        }
        System.out.println("结束。");
    }



    @Override
    public void setPrinterName(String name) {
        this.name=name;

    }

    @Override
    public String getPrinterName() {
        return this.name;

    }

    @Override
    public void print(String string) {
        System.out.println("==============="+name+"==============");
        System.out.println(string);

    }
}
